import Main from "@/components/main";
import parentView from "@/components/parent-view";

import Router from "vue-router";
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
};

/**
 * iview-admin中meta除了原生参数外可配置的参数:
 * meta: {
 *  title: { String|Number|Function }
 *         显示在侧边栏、面包屑和标签栏的文字
 *         使用'{{ 多语言字段 }}'形式结合多语言使用，例子看多语言的路由配置;
 *         可以传入一个回调函数，参数是当前路由对象，例子看动态路由和带参路由
 *  hideInBread: (false) 设为true后此级路由将不会出现在面包屑中，示例看QQ群路由配置
 *  hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *  notCache: (false) 设为true后页面在切换标签后不会缓存，如果需要缓存，无需设置这个字段，而且需要设置页面组件name属性和路由配置的name一致
 *  access: (null) 可访问该页面的权限数组，当前路由设置的权限会影响子路由
 *  icon: (-) 该页面在左侧菜单、面包屑和标签导航处显示的图标，如果是自定义图标，需要在图标名称前加下划线'_'
 *  beforeCloseName: (-) 设置该字段，则在关闭当前tab页时会去'@/router/before-close.js'里寻找该字段名对应的方法，作为关闭前的钩子函数
 * }
 */

export default [{
        path: "/login",
        name: "login",
        meta: {
            title: "Login - 登录",
            hideInMenu: true
        },
        component: () =>
            import ("@/view/login/login.vue")
    },
    {
        path: "/",
        name: "_home",
        redirect: "/home",
        component: Main,
        meta: {
            hideInMenu: true,
            notCache: true
        },
        children: [{
            path: "/home",
            name: "home",
            meta: {
                hideInMenu: true,
                title: "首页",
                notCache: true,
                icon: "md-home"
            },
            component: () =>
                import ("@/view/single-page/home")
        }]
    },
    {
        path: "/staffManagement",
        name: "staffManagement",
        component: Main,
        meta: {
            hideInBread: true,
            title: "人员管理",
            access: [1],
            id: 1
        },
        children: [{
                path: "staff-page",
                name: "staff-page",
                meta: {
                    icon: "md-settings",
                    title: "人员管理",
                    access: [1]
                },
                component: () =>
                    import ("@/view/staff/staff-page.vue")
            },
            {
                path: "staff-edit/:id",
                name: "staff-edit",
                meta: {
                    title: "人员修改",
                    hideInMenu: true,
                    hideInBread: true,
                    access: [1]
                },
                component: () =>
                    import ("@/view/staff/staff-edit.vue")
            }
        ]
    },
    {
        path: "/rolePower",
        name: "rolePower",
        component: Main,
        meta: {
            hideInBread: true,
            title: "角色权限",
            access: [16],
            id: 16
        },
        children: [{
                path: "role-power",
                name: "role-power",
                meta: {
                    icon: "md-settings",
                    title: "角色权限",
                    access: [16]
                },
                component: () =>
                    import ("@/view/role-power/role-power.vue")
            },
            {
                path: "wx_app_power/:id",
                name: "wx_app_power",
                meta: {
                    hideInMenu: true,
                    hideInBread: true,
                    title: "小程序权限",
                    access: [16]
                },
                component: () =>
                    import ("@/view/role-power/wx_app_power.vue")
            },

        ]
    },

    {
        path: "/branchManagement",
        name: "branchManagement",
        component: Main,
        meta: {
            icon: "md-settings",
            showAlways: true,
            title: " 分部管理",
            access: [2],
            id: 2
        },
        children: [{
                path: "branch-page",
                name: "branch-page",
                meta: {
                    icon: "md-radio-button-on",
                    title: "分部管理",
                    access: [2]
                },
                component: () =>
                    import ("@/view/branch/branch-page.vue")
            },
            {
                path: "floor-page/",
                name: "floor-page",
                meta: {
                    icon: "md-radio-button-on",
                    title: "楼层管理",
                    access: [2]
                },
                component: () =>
                    import ("@/view/branch/floor-page.vue")
            },
            {
                path: "area-page",
                name: "area-page",
                meta: {
                    icon: "md-radio-button-on",
                    title: "区域管理",
                    access: [2]
                },
                component: () =>
                    import ("@/view/branch/area-page.vue")
            },
            {
                path: "workstation-team",
                name: "workstation-team",
                meta: {
                    title: "工位/办公室管理",
                    icon: "md-radio-button-on",
                    access: [2]
                },
                component: () =>
                    import ("@/view/branch/workstation/workstation-team.vue")
            },
            {
                path: "workstation-add",
                name: "workstation-add",
                meta: {
                    title: "新增工位/办公室",
                    hideInMenu: true,
                    hideInBread: true,
                    access: [2]
                },
                component: () =>
                    import ("@/view/branch/workstation/workstation-add.vue")
            },
            {
                path: "workstation-details/:wsid",
                name: "workstation-details",
                meta: {
                    title: "工位/办公室详情",
                    hideInMenu: true,
                    hideInBread: true,
                    access: [2]
                },
                component: () =>
                    import ("@/view/branch/workstation/workstation-details.vue")
            },
            {
                path: "workstation-edit",
                name: "workstation-edit",
                meta: {
                    title: "修改工位/办公室",
                    hideInMenu: true,
                    hideInBread: true,
                    access: [2]
                },
                component: () =>
                    import ("@/view/branch/workstation/workstation-edit.vue")
            },
            {
                path: "officeInfo-edit",
                name: "officeInfo-edit",
                meta: {
                    title: "修改公司信息",
                    hideInMenu: true,
                    hideInBread: true,
                    access: [2]
                },
                component: () =>
                    import ("@/view/branch/workstation/officeInfo-edit.vue")
            },
            {
                path: "module-page",
                name: "module-page",
                meta: {
                    icon: "md-radio-button-on",
                    title: "模块管理",
                    access: [2]
                },
                component: () =>
                    import ("@/view/branch/module-page.vue")
            }
        ]
    },
    {
        path: "/checkManagement",
        name: "checkManagement",
        meta: {
            icon: "md-settings",
            title: " 巡店管理",
            showAlways: true,
            access: [3],
            id: 3
        },
        component: Main,
        children: [{
                path: 'check-log',
                name: 'check-log',
                meta: {
                    icon: 'md-radio-button-on',
                    title: '明细',
                    access: [3]
                },
                component: () =>
                    import ('@/view/check/check-log.vue')
            },
            {
                path: 'check-all',
                name: 'check-all',
                meta: {
                    icon: 'md-radio-button-on',
                    title: '统计',
                    access: [3]
                },
                component: () =>
                    import ('@/view/check/check-all.vue')
            },
            {
                path: 'check-setting',
                name: 'check-setting',
                meta: {
                    icon: 'md-radio-button-on',
                    title: '巡店设置',
                    access: [3]
                },
                component: () =>
                    import ('@/view/check/check-setting.vue')
            },
            {
                path: "checkTmp-setting",
                name: "checkTmp-setting",
                meta: {
                    icon: "md-radio-button-on",
                    title: "巡店模板设置",
                    access: [3]
                },
                component: () =>
                    import ("@/view/check/checkTmp-setting.vue")
            },
            {
                path: 'log-details/:id',
                name: 'log-details',
                meta: {
                    title: '巡店详情',
                    hideInMenu: true,
                    notCache: true,
                    hideInBread: true,
                    access: [3]
                },
                component: () =>
                    import ('@/view/check/log-details.vue')
            },
            {
                path: 'workStationUseInfo/:branchid:floorid:regionid:cp_floorid:cp_branchid:cp_type',
                name: 'workStationUseInfo',
                meta: {
                    title: '工位/办公室使用详情',
                    hideInMenu: true,
                    notCache: true,
                    hideInBread: true,
                    access: [3]
                },
                component: () =>
                    import ('@/view/check/workStationUseInfo.vue')
            },
            // {
            //     path: 'order-details',
            //     name: 'order-details',
            //     meta: {
            //         title: '工单详情',
            //         hideInMenu: true,
            //         notCache: true,
            //         hideInBread: true,
            //         access: [3]
            //     },
            //     component: () =>
            //         import ('@/view/check/order-details.vue')
            // },
        ]
    },
    {
        path: "/roomInfo",
        name: "roomInfo",
        meta: {
            icon: "md-settings",
            title: " 空间信息",
            showAlways: true,
            access: [4],
            id: 4
        },
        component: Main,
        children: [{
                path: "branch-info",
                name: "branch-info",
                meta: {
                    icon: "md-radio-button-on",
                    title: "分部",
                    access: [4]
                },
                component: () =>
                    import ("@/view/room-info/branch-info.vue")
            },
            {
                path: "floor-info",
                name: "floor-info",
                meta: {
                    icon: "md-radio-button-on",
                    title: "楼层",
                    access: [4]
                },
                component: () =>
                    import ("@/view/room-info/floor-info.vue")
            },
            {
                path: "info-all",
                name: "info-all",
                meta: {
                    icon: "md-radio-button-on",
                    title: "可视化",
                    access: [4]
                },
                component: () =>
                    import ("@/view/room-info/info-all.vue")
            },
            {
                path: "remark-page",
                name: "remark-page",
                meta: {
                    icon: "md-radio-button-on",
                    title: "备注汇编",
                    access: [4]
                },
                component: () =>
                    import ("@/view/room-info/remark-page.vue")
            },
        ]
    },
    {
        path: "/questionManagement",
        name: "questionManagement",
        meta: {
            icon: "md-settings",
            title: " 小课堂管理",
            showAlways: true,
            access: [5],
            id: 5
        },
        component: Main,
        children: [{
                path: "question-page",
                name: "question-page",
                meta: {
                    icon: "md-radio-button-on",
                    title: "题库中心",
                    access: [5]
                },
                component: () =>
                    import ("@/view/question/question-page.vue")
            },
            {
                path: "question-set",
                name: "question-set",
                meta: {
                    icon: "md-radio-button-on",
                    title: "学习中心",
                    access: [5]
                },
                component: () =>
                    import ("@/view/question/question-set.vue")
            },
            {
                path: "question-result",
                name: "question-result",
                meta: {
                    icon: "md-radio-button-on",
                    title: "答题详情",
                    access: [5]
                },
                component: () =>
                    import ("@/view/question/question-result.vue")
            },
            {
                path: "question-detail/:id",
                name: "question-detail",
                meta: {
                    title: "题库详情",
                    hideInMenu: true,
                    hideInBread: true,
                    access: [5]
                },
                component: () =>
                    import ("@/view/question/question-detail.vue")
            },
            {
                path: "study-detail",
                name: "study-detail",
                meta: {
                    title: "学习设置",
                    hideInMenu: true,
                    hideInBread: true,
                    access: [5]
                },
                component: () =>
                    import ("@/view/question/study-detail.vue")
            }
        ]
    },
    {
        path: "/fileManagement",
        name: "fileManagement",
        component: Main,
        meta: {
            icon: "md-settings",
            title: " 工作云盘",
            showAlways: true,
            access: [6],
            id: 6
        },
        children: [{
            path: "file-page",
            name: "file-page",
            meta: {
                icon: "ios-folder",
                title: "文件中心",
                access: [6]
            },
            component: () =>
                import ("@/view/file/file-page.vue")
        }, ]
    },
    {
        path: "/matterManagement",
        name: "matterManagement",
        component: Main,
        meta: {
            hideInBread: true,
            title: "事项",
            access: [7],
            id: 7
        },
        children: [{
                path: "matter-page",
                name: "matter-page",
                meta: {
                    icon: "md-settings",
                    title: "事项",
                    access: [7]
                },
                component: () =>
                    import ("@/view/matter/matter-page.vue")
            },
            {
                path: "matter-detail/:matterid",
                name: "matter-detail",
                meta: {
                    title: "事项详情",
                    hideInMenu: true,
                    hideInBread: true,
                    access: [7]
                },
                component: () =>
                    import ("@/view/matter/matter-detail.vue")
            }
        ]
    },
    {
        path: "/extendManagement",
        name: "extendManagement",
        component: Main,
        meta: {
            hideInBread: true,
            title: "推广工作",
            access: [8],
            id: 8
        },
        children: [{
                path: "extend-page",
                name: "extend-page",
                meta: {
                    icon: "md-settings",
                    title: "推广工作",
                    access: [8]
                },
                component: () =>
                    import ("@/view/extend/extend-page.vue")
            },
            {
                path: "work-all",
                name: "work-all",
                meta: {
                    title: "工作统计",
                    hideInMenu: true,
                    hideInBread: true,
                    access: [8]
                },
                component: () =>
                    import ("@/view/extend/work-all.vue")
            },
        ]
    },
    {
        path: "/dailyManagement",
        name: "dailyManagement",
        component: Main,
        meta: {
            hideInBread: true,
            title: "日常工作",
            access: [9],
            id: 9
        },
        children: [{
            path: "daily-page",
            name: "daily-page",
            meta: {
                icon: "md-settings",
                title: "工作日志",
                access: [9]
            },
            component: () =>
                import ("@/view/daily/daily-page.vue")
        }]
    },
    {
        path: "/activeManagement",
        name: "activeManagement",
        component: Main,
        meta: {
            hideInBread: true,
            title: "活动开展",
            access: [10],
            id: 10
        },
        children: [{
            path: "active-page",
            name: "active-page",
            meta: {
                icon: "md-settings",
                title: "活动开展",
                access: [10]
            },
            component: () =>
                import ("@/view/active/active-page.vue")
        }]
    },
    {
        path: "/noticeManagement",
        name: "noticeManagement",
        component: Main,
        meta: {
            hideInBread: true,
            title: "通知公告",
            access: [11],
            id: 11
        },
        children: [{
            path: "notice-page",
            name: "notice-page",
            meta: {
                icon: "md-settings",
                title: "通知公告",
                access: [11]
            },
            component: () =>
                import ("@/view/notice/notice-page.vue")
        }]
    },
    {
        path: "/advManagement",
        name: "advManagement",
        component: Main,
        meta: {
            hideInBread: true,
            title: "广告管理",
            access: [18],
            id: 18
        },
        children: [{
            path: "adv",
            name: "adv",
            meta: {
                icon: "md-settings",
                title: "广告管理",
                access: [18]
            },
            component: () =>
                import ("@/view/adv/adv.vue")
        }]
    },
    {
        path: "/dailyDataManagement",
        name: "dailyDataManagement",
        component: Main,
        meta: {
            icon: "md-settings",
            title: " 每日数据",
            showAlways: true,
            access: [12],
            id: 12
        },
        children: [{
                path: "daily-data-detail",
                name: "daily-data-detail",
                meta: {
                    icon: "md-radio-button-on",
                    title: "明细",
                    access: [12]
                },
                component: () =>
                    import ("@/view/daily-data/daily-data-detail.vue")
            },
            {
                path: "daily-data-all",
                name: "daily-data-all",
                meta: {
                    icon: "md-radio-button-on",
                    title: "统计",
                    access: [12]
                },
                component: () =>
                    import ("@/view/daily-data/daily-data-all.vue")
            },
            {
                path: "daily-data-edit/:id",
                name: "daily-data-edit",
                meta: {
                    title: "修改每日数据",
                    hideInMenu: true,
                    hideInBread: true,
                    access: [12]
                },
                component: () =>
                    import ("@/view/daily-data/daily-data-edit.vue")
            },
            {
                path: "targets-page",
                name: "targets-page",
                meta: {
                    icon: "md-radio-button-on",
                    title: "目标金额",
                    access: [12]
                },
                component: () =>
                    import ("@/view/daily-data/targets-page.vue")
            }
        ]
    },
    {
        path: "/journalManagement",
        name: "journalManagement",
        component: Main,
        meta: {
            icon: "md-settings",
            title: " 日记账",
            showAlways: true,
            access: [13],
            id: 13
        },
        children: [{
                path: "journal-page-detail",
                name: "journal-page-detail",
                meta: {
                    icon: "md-radio-button-on",
                    title: "明细",
                    access: [13]
                },
                component: () =>
                    import ("@/view/journal/journal-page-detail.vue")
            },
            {
                path: "journal-edit/:wraid",
                name: "journal-edit",
                meta: {
                    title: "修改日记账",
                    hideInMenu: true,
                    hideInBread: true,
                    access: [13]
                },
                component: () =>
                    import ("@/view/journal/journal-edit.vue")
            },
            {
                path: "journal-page-all",
                name: "journal-page-all",
                meta: {
                    icon: "md-radio-button-on",
                    title: "统计",
                    access: [13]
                },
                component: () =>
                    import ("@/view/journal/journal-page-all.vue")
            },
            {
                path: 'account-category-setting',
                name: 'account-category-setting',
                meta: {
                    icon: 'md-radio-button-on',
                    title: '账目类别设置',
                    access: [13]
                },
                component: () =>
                    import ('@/view/journal/account-category-setting.vue')
            }
        ]
    },
    {
        path: "/integralManagement",
        name: "integralManagement",
        component: Main,
        meta: {
            icon: "md-settings",
            title: " 积分",
            showAlways: true,
            access: [14],
            id: 14
        },
        children: [{
                path: "integral-page-detail",
                name: "integral-page-detail",
                meta: {
                    icon: "md-radio-button-on",
                    title: "明细",
                    access: [14]
                },
                component: () =>
                    import ("@/view/integral/integral-page-detail.vue")
            },
            {
                path: "integral-page-bonus",
                name: "integral-page-bonus",
                meta: {
                    icon: "md-radio-button-on",
                    title: "统计",
                    access: [14]
                },
                component: () =>
                    import ("@/view/integral/integral-page-bonus.vue")
            },
            {
                path: 'integral-page-set',
                name: 'integral-page-set',
                meta: {
                    icon: 'md-radio-button-on',
                    title: '设置',
                    access: [14]
                },
                component: () =>
                    import ('@/view/integral/integral-page-set.vue')
            },
        ]
    },

    // {
    //     path: '/reportFormManagement',
    //     name: 'reportFormManagement',
    //     meta: {
    //         icon: 'md-settings',
    //         title: '报表',
    //         showAlways: true
    //     },
    //     component: Main,
    //     children: [{
    //             path: 'reportForm-branch',
    //             name: 'reportForm-branch',
    //             meta: {
    //                 icon: 'md-radio-button-on',
    //                 title: '分部',
    //             },
    //             component: () =>
    //                 import ('@/view/reportForm/reportForm-branch.vue')
    //         },
    //         {
    //             path: 'reportForm-personal',
    //             name: 'reportForm-personal',
    //             meta: {
    //                 icon: 'md-radio-button-on',
    //                 title: '个人',
    //             },
    //             component: () =>
    //                 import ('@/view/reportForm/reportForm-personal.vue')
    //         }
    //     ]
    // },
    {
        path: "/scanManagement",
        name: "scanManagement",
        component: Main,
        meta: {
            icon: "md-settings",
            title: " 工位扫码",
            showAlways: true,
            access: [17],
            id: 17
        },
        children: [{
                path: "scan-detail",
                name: "scan-detail",
                meta: {
                    icon: "md-settings",
                    title: "扫描明细",
                    access: [17]
                },
                component: () =>
                    import ("@/view/workstation-scan/scan-detail.vue")
            },
            {
                path: "scan-total",
                name: "scan-total",
                meta: {
                    icon: "md-settings",
                    title: "扫描统计",
                    access: [17]
                },
                component: () =>
                    import ("@/view/workstation-scan/scan-total.vue")
            },
            {
                path: "msg-detail",
                name: "msg-detail",
                meta: {
                    icon: "md-settings",
                    title: "留言明细",
                    access: [17]
                },
                component: () =>
                    import ("@/view/workstation-scan/msg-detail.vue")
            },
        ]
    },
    {
        path: "/mistakeManagement",
        name: "mistakeManagement",
        component: Main,
        meta: {
            icon: "md-settings",
            title: "知错能改",
            showAlways: true,
            access: [19],
            id: 19
        },
        children: [{
                path: "mistake-check",
                name: "mistake-check",
                meta: {
                    icon: "md-settings",
                    title: "巡店明细",
                    access: [19]
                },
                component: () =>
                    import ("@/view/mistake/mistake-check.vue")
            },
            {
                path: "mistake-matter",
                name: "mistake-matter",
                meta: {
                    icon: "md-settings",
                    title: "事项明细",
                    access: [19]
                },
                component: () =>
                    import ("@/view/mistake/mistake-matter.vue")
            },
        ]
    },


    {
        path: '/handleLogManagement',
        name: 'handleLogManagement',
        component: Main,
        meta: {
            hideInBread: true,
            title: '操作日志',
            access: [15],
            id: 15
        },
        children: [{
            path: 'handle-log',
            name: 'handle-log',
            meta: {
                icon: 'md-settings',
                title: '操作日志',
                access: [15]
            },
            component: () =>
                import ('@/view/handle-log/handle-log-page.vue')
        }]
    },
    // {
    //     path: '/setting',
    //     name: 'setting',
    //     component: Main,
    //     meta: {
    //         icon: 'md-settings',
    //         title: ' 设置',
    //         showAlways: true,
    //         access: [1, 2]
    //     },
    //     children: [{
    //         path: 'account-category-setting',
    //         name: 'account-category-setting',
    //         meta: {
    //             icon: 'md-settings',
    //             title: '账目类别设置',
    //             access: [1, 2]
    //         },
    //         component: () =>
    //             import ('@/view/set/account-category-setting.vue')
    //     }]
    // },
    {
        path: '/reload',
        name: 'reload',
        meta: {
            hideInMenu: true
        },
        component: Main,
        children: [{
            path: "reload-page",
            name: "reload-page",
            meta: {
                hideInMenu: true
            },
            component: () =>
                import ('@/view/reload-page.vue')
        }]
    },
    {
        path: "/401",
        name: "error_401",
        meta: {
            hideInMenu: true
        },
        component: () =>
            import ("@/view/error-page/401.vue")
    },
    {
        path: "/500",
        name: "error_500",
        meta: {
            hideInMenu: true
        },
        component: () =>
            import ("@/view/error-page/500.vue")
    },
    {
        path: "*",
        name: "error_404",
        meta: {
            hideInMenu: true
        },
        component: () =>
            import ("@/view/error-page/404.vue")
    }
];